package cn.afactory.tygz.ui.fragments;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import cn.afactory.tygz.R;
import cn.afactory.tygz.model.UserInfo;
import cn.afactory.tygz.ui.sns.UserProfileActivity;

/**
 * Created by Kenneth on 15/9/17.
 */
public class ProfileUserInfoFragment extends cn.afactory.tygz.ui.base.BaseFragment {

    private UserInfo userInfo;

    private TextView personalIntroduce;
    private TextView personalDest;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        addTitleBar = false;
        userInfo = (UserInfo)getArguments().getSerializable(UserProfileActivity.USER_INFO_TAG);
    }

    @Override
    public View onCreateViewCustom(LayoutInflater inflater, ViewGroup container) {
        View view = inflater.inflate(R.layout.fg_profile_user_info, null);
        personalIntroduce = (TextView)view.findViewById(R.id.personal_introduce);
        personalDest = (TextView)view.findViewById(R.id.personal_dest);

        if (null != userInfo && null != userInfo.intro && userInfo.intro.trim().length() > 0) {
            personalIntroduce.setText(userInfo.intro);
        } else {
            personalIntroduce.setText("");
        }

        if (null != userInfo && null != userInfo.dest && userInfo.dest.trim().length() > 0) {
            personalDest.setText(userInfo.dest);
        } else {
            personalDest.setText("");
        }

        return view;
    }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

    }
}
